<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="overflow:hidden">
<head>
    <title>$!app_name</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 框架 -->
    <link href="${base}/include/css/msg.css" rel="stylesheet" type="text/css"/>
    <link href="${base}/include/css/default.css" rel="stylesheet" type="text/css"/>
	<script type='text/javascript'>
		var CONTEXTPATH = '${base}';
	</script>
    <script src="${base}/include/js/main.js"></script>
    <script src="${base}/include/js/string.js"></script>
    <!-- 树 -->
    <script type="text/javascript" src="${base}/include/controls/ztree/jquery.ztree.core-3.5.min.js"></script> 
	<script type="text/javascript" src="${base}/include/controls/ztree/jquery.ztree.excheck-3.5.min.js"></script>
    <script type="text/javascript" src="${base}/include/controls/ztree/jquery.ztree.exedit-3.5.min.js"></script>
	<link rel="stylesheet" href="${base}/include/controls/ztree/zTreeStyle/zTreeStyle.css" type="text/css">

<head>
<body leftmargin="0" topmargin="0">
<script type="text/javascript">
    var setting = {
			view: {
				selectedMulti: false ,
                nameIsHTML: true
			},
            edit: {
				drag: {
					autoExpandTrigger: true,
					prev: dropPrev,
					inner: dropInner,
					next: dropNext
				},
				enable: true,
				showRemoveBtn: false,
				showRenameBtn: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				beforeDrag: beforeDrag,
				beforeDrop: beforeDrop
			}
		};
        var zNodes =#if($str)$!str #else [] #end ;
        var className = "dark", curDragNodes, autoExpandNode;
        var ztreeObj;
		jQuery(document).ready(function(){
			ztreeObj=jQuery.fn.zTree.init(jQuery("#treeDemo"), setting, zNodes);
		});
		function beforeDrag(treeId, treeNodes) {
			for (var i=0,l=treeNodes.length; i<l; i++) {
				if (treeNodes[i].drag === false) {
					return false;
				}
			}
			return true;
		}
		function beforeDrop(treeId, treeNodes, targetNode, moveType) {
			return targetNode ? targetNode.drop !== false : true;
		}
    		function dropPrev(treeId, nodes, targetNode) {
			var pNode = targetNode.getParentNode();
			if (pNode && pNode.dropInner === false) {
				return false;
			} else {
				for (var i=0,l=curDragNodes.length; i<l; i++) {
					var curPNode = curDragNodes[i].getParentNode();
					if (curPNode && curPNode !== targetNode.getParentNode() && curPNode.childOuter === false) {
						return false;
					}
				}
			}
			return true;
		}
		function dropInner(treeId, nodes, targetNode) {
			if (targetNode && targetNode.dropInner === false) {
				return false;
			} else {
				for (var i=0,l=curDragNodes.length; i<l; i++) {
					if (!targetNode && curDragNodes[i].dropRoot === false) {
						return false;
					} else if (curDragNodes[i].parentTId && curDragNodes[i].getParentNode() !== targetNode && curDragNodes[i].getParentNode().childOuter === false) {
						return false;
					}
				}
			}
			return true;
		}
		function dropNext(treeId, nodes, targetNode) {
			var pNode = targetNode.getParentNode();
			if (pNode && pNode.dropInner === false) {
				return false;
			} else {
				for (var i=0,l=curDragNodes.length; i<l; i++) {
					var curPNode = curDragNodes[i].getParentNode();
					if (curPNode && curPNode !== targetNode.getParentNode() && curPNode.childOuter === false) {
						return false;
					}
				}
			}
			return true;
		}
    		function beforeDrag(treeId, treeNodes) {
			className = (className === "dark" ? "":"dark");
			for (var i=0,l=treeNodes.length; i<l; i++) {
				if (treeNodes[i].drag === false) {
					curDragNodes = null;
					return false;
				} else if (treeNodes[i].parentTId && treeNodes[i].getParentNode().childDrag === false) {
					curDragNodes = null;
					return false;
				}
			}
			curDragNodes = treeNodes;
			return true;
		}
        function getIdsTree(){
            var nodes = ztreeObj.transformToArray(ztreeObj.getNodes());
            var ids="";
           
            for(var i=0;i<nodes.length;i++){
               ids += nodes[i].id + ",";
            }
            
            if(ids!=""&&ids!=","){
            	
                document.getElementById("checkids").value=ids;
                return true;
            }
            return false;

        }

 </script>
<table width="100%" border="0" cellspacing="0" cellpadding="6" style="border-collapse: separate; border-spacing: 6px;">
    <tr valign="top">
        <td>
            <form name='form1' id="form1" method='post'
                  action='${base}/private/sys/res/sort' >
                <input type="hidden" name="checkids" id="checkids" value="" >
                <input type="hidden" name="commit" id="commit" value="0">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td >
                             <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr>
                                    <td style="padding:0px 5px;">
                                        <table width="100%" id="dg1" cellpadding="0" cellspacing="0" afterdrag="sortMenu" sortstring="" page="false" size="0"  multiselect="true" autofill="true" scroll="false" lazy="false" cachesize="0">

                                             <tr style1="backgroundcolor:#FEFEFE" style2="backgroundcolor:#F9FBFC" >
                                                            <td align="left" >
                                                                <div ztype='_Tree' style='-moz-user-select:none;height:330px;width:400px;' id='tree1' class='treeItemN'>

                                                    <ul id="treeDemo" class="ztree" style="height:310px;width:380px;overflow-x:hidden"></ul>
                                                  </div>
                                              </td></tr>
                                        </table>

                                    </td>
                                </tr>
                          </table>
                        </td>
                    </tr>
                </table>
            </form>
        </td>
    </tr>
</table>
</body>
</html>